Clean up compiler.h to define a few more things and update
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 1 May 2006 16:44:51 +0000 (17:44 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 1 May 2006 16:44:51 +0000 (17:44 +0100)
for gcc4.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/shutdown.c
xen/include/asm-ia64/config.h
xen/include/asm-x86/config.h
xen/include/asm-x86/uaccess.h
xen/include/xen/compiler.h
xen/include/xen/config.h

index 45085d203d20459905ce3d9f73569ed1a10f82a4..4f59b2c983908f18568f4da17b0da892d68f4be7 100644 (file)
@@ -41,7 +41,7 @@ static inline void kb_wait(void)
             break;
 }
 
-static void __machine_halt(void *unused) __attribute__((noreturn))
+static void  __attribute__((noreturn)) __machine_halt(void *unused)
 {
     for ( ; ; )
         __asm__ __volatile__ ( "hlt" );
index b6db2f2adf7632de8a539166139bfbd6004abe12..29daf0c92f4b51fe97e11af173cb2fc980c4b845 100644 (file)
@@ -79,8 +79,6 @@ extern struct page_info *mem_map;
 extern char _end[]; /* standard ELF symbol */
 
 // linux/include/linux/compiler.h
-#define __attribute_const__
-#define __user
 //#define __kernel
 //#define __safe
 #define __force
@@ -98,7 +96,6 @@ extern char _end[]; /* standard ELF symbol */
 // xen/include/asm/config.h
 //#define HZ 1000
 // FIXME SMP: leave SMP for a later time
-#define barrier() __asm__ __volatile__("": : :"memory")
 
 ///////////////////////////////////////////////////////////////
 // xen/include/asm/config.h
index 4ac128ff967b8ac1452cff3c4fbb9f0aaa86a8b8..2b80b5643d1b7351bcca2b9cc4b3d7747c7c3357 100644 (file)
@@ -63,8 +63,6 @@
   name:
 #endif
 
-#define barrier() __asm__ __volatile__("": : :"memory")
-
 /* A power-of-two value greater than or equal to number of hypercalls. */
 #define NR_hypercalls 64
 
index b0bca22c7bc41fe5685a6a379eb0ab667ad5b3d9..e9004e490f2899973b11556295f519db68e30fb1 100644 (file)
@@ -8,8 +8,6 @@
 #include <xen/prefetch.h>
 #include <asm/page.h>
 
-#define __user
-
 #ifdef __x86_64__
 #include <asm/x86_64/uaccess.h>
 #else
index d4e5a43b2ec75788bd539182eb4cbfb5f439b6d4..2cf74900dc1427dd29bbc4c6bd2fc5ced20f96f3 100644 (file)
@@ -1,17 +1,21 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
-   a mechanism by which the user can annotate likely branch directions and
-   expect the blocks to be reordered appropriately.  Define __builtin_expect
-   to nothing for earlier compilers.  */
-
-#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
-#define __builtin_expect(x, expected_value) (x)
+#if !defined(__GNUC__) || (__GNUC__ < 3)
+#error Sorry, your compiler is too old/not recognized.
 #endif
 
-#define likely(x)      __builtin_expect((x),1)
-#define unlikely(x)    __builtin_expect((x),0)
+#define barrier()     __asm__ __volatile__("": : :"memory")
+
+#define likely(x)     __builtin_expect((x),1)
+#define unlikely(x)   __builtin_expect((x),0)
+
+#define inline        __inline__
+#define always_inline __inline__ __attribute__ ((always_inline))
+#define noinline      __attribute__((noinline))
+
+#define __attribute_pure__  __attribute__((pure))
+#define __attribute_const__ __attribute__((__const__))
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 #define __attribute_used__ __attribute__((__used__))
 #define __must_check
 #endif
 
+#if __GNUC__ > 3
+#define offsetof(a,b) __builtin_offsetof(a,b)
+#else
+#define offsetof(a,b) ((unsigned long)&(((a *)0)->b))
+#endif
+
 /* This macro obfuscates arithmetic on a variable address so that gcc
    shouldn't recognize the original var, and make assumptions about it */
 /*
index 3356df15fb285cd57b9621580b441205fba2e0d5..e38cf9e3664fef3b9912788fe36c044accf28bdf 100644 (file)
 #include <asm/config.h>
 
 #define EXPORT_SYMBOL(var)
-#define offsetof(_p,_f) ((unsigned long)&(((_p *)0)->_f))
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
-#define always_inline __inline__ __attribute__ ((always_inline))
-
 /* Linux syslog levels. */
 #define KERN_NOTICE  ""
 #define KERN_WARNING ""